import request from '../utils/request'

// 获取全部公告/轮播图
const getPost = async () => {
  try {
    const res = await request.get('/api/post/getPost')
    console.log('请求成功', res.data)
    return res.data
  } catch (error) {
    console.error('请求失败', error)
    return null
  }
}

// 删除帖子
const deletePostById = async (postId) => {
  try {
    const res = await request.delete(`/api/post/deletePostById/${postId}`)
    return res.data
  } catch (error) {
    console.error('删除帖子失败', error)
    return null
  }
}

export { getPost, deletePostById }